package com.chen.test;


import com.alibaba.druid.pool.DruidDataSource;
import com.chen.pojo.User;
import org.junit.Test;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;

public class test1 {



    @Test
    public void test1() {
        ClassPathXmlApplicationContext app = new ClassPathXmlApplicationContext("applicationContext.xml");
        JdbcTemplate jdbcTemplate = (JdbcTemplate) app.getBean("jdbcTemplate");
        User user = jdbcTemplate.queryForObject("select * from user where username = ?", new BeanPropertyRowMapper<User>(User.class), "张三疯");
        System.out.println(user);
        //System.out.println(jdbcTemplate);

    }

}
